package ArrayListDemo1;

import java.util.ArrayList;

public class ArrayList06 {
    public static void main(String[] args) {
        ArrayList<User>list=new ArrayList<>();
        User u1=new User("010001","zhangsan","123456");
        User u2=new User("010002","lisi","123456");
        User u3=new User("010003","wangwu","123456");
        list.add(u1);
        list.add(u2);
        list.add(u3);
        boolean flag=contains(list,"010003");
        System.out.println(flag);


    }
    public static boolean contains(ArrayList<User>list,String id){
        for (int i = 0; i < list.size(); i++) {
            if(list.get(i).getId().equals(id)){
                return true;
            }

        }
        return  false;
    }
}
